a= int(input())
b= int(input())
if 0 < a < 60 or 0 < b < 60:
    if a < 60 and b < 60:
        print(0)
    else:
        print(1)
else:
    print(0)

